package com.k12.user.service.impl;

import com.k12.user.model.entity.SysAreaCities;
import com.k12.user.mapper.SysAreaCitiesDao;
import com.k12.user.service.SysAreaCitiesService;
import org.springframework.stereotype.Service;
import java.util.List;

import javax.annotation.Resource;
import java.util.List;

/**
 * 城市代码库(SysAreaCities)表服务实现类
 *
 * @author makejava
 * @since 2025-07-28 20:53:10
 */
@Service("sysAreaCitiesService")
public class SysAreaCitiesServiceImpl implements SysAreaCitiesService {
    @Resource
    private SysAreaCitiesDao sysAreaCitiesDao;

    /**
     * 通过ID查询单条数据
     *
     * @param id 主键
     * @return 实例对象
     */
    @Override
    public SysAreaCities queryById(Integer id) {
        return this.sysAreaCitiesDao.queryById(id);
    }

    /**
     * 分页查询
     *
     * @param sysAreaCities 筛选条件
     * @param pageRequest      分页对象
     * @return 查询结果
     */
    @Override
    public List<SysAreaCities> queryByPage(SysAreaCities sysAreaCities) {
        return this.sysAreaCitiesDao.queryAllByLimit(sysAreaCities);
    }

    /**
     * 新增数据
     *
     * @param sysAreaCities 实例对象
     * @return 实例对象
     */
    @Override
    public SysAreaCities insert(SysAreaCities sysAreaCities) {
        this.sysAreaCitiesDao.insert(sysAreaCities);
        return sysAreaCities;
    }

    /**
     * 修改数据
     *
     * @param sysAreaCities 实例对象
     * @return 实例对象
     */
    @Override
    public SysAreaCities update(SysAreaCities sysAreaCities) {
        this.sysAreaCitiesDao.update(sysAreaCities);
        return this.queryById(sysAreaCities.getId());
    }

    /**
     * 通过主键删除数据
     *
     * @param id 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Integer id) {
        return this.sysAreaCitiesDao.deleteById(id) > 0;
    }
}
